package br.unicamp.ic.lis.dbvapi.utils;

import org.apache.commons.lang3.StringUtils;
import org.genericspatialdao.utils.ConstantsUtils;

public class IRIUtils {

	private static String DEFAULT_BASE_IRI = "http://lis.ic.unicamp.br";

	public static String getBaseIRI(Object object) {
		String baseIRI = PropertiesUtils.getString("base.iri");
		if (StringUtils.isBlank(baseIRI)) {
			baseIRI = DEFAULT_BASE_IRI;
		}

		if (!StringUtils.endsWith(baseIRI, ConstantsUtils.SLASH)) {
			baseIRI = baseIRI + ConstantsUtils.SLASH;
		}

		return baseIRI + object.getClass().getSimpleName()
				+ ConstantsUtils.SLASH;
	}
}
